<?php
include 'islogin.php';
include '../config.php';

if(isset($_GET['flag']))
{

	if($_GET['flag']=='del')
	{
		$sql = "update en_download set flag =0 where id=".$_GET['id'];
		mysql_query($sql);
	}
}
?>
<script src="../js/jquery-1.7.1.js"></script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<link href="css/right.css" rel="stylesheet" type="text/css"/>
<script>
function mouseoverTD(obj)
{
	   $(obj).css("background","#aaa");
}
function mouseoutTD(obj)
{
	  $(obj).css("background","");
}

function del(id,obj)
{
	  if(confirm("是否要删除此下载文件？"))
	  {
		  var url = "downloadList.php?flag=del&id="+id;
		  
		  window.location.href=url;
	  }
	  
}
</script>


<div style="border:0px solid red;"> 

    	<div id="top"><div>相关下载</div></div>
    	
	    <div id="middle">
	    	<!-- 类型列表 -->
	      <div class="layout">
		       <div class="title">下载列表</div>
		       <div class="content">
		       
		       	 <table  cellspacing="0" cellpadding="0">  
			   				<tr >
				   		   		<td class="title_some_td" style="width:300px; text-align:center;">名称</td>
				   		   		<td class="title_some_td" style="width:100px; text-align:center;">日期</td>
				   		   		<td class="title_some_td" style="width:100px; text-align:center;">类型</td>
				   		   		<td class="title_some_td" style="width:100px; text-align:center;">操作</td>
				   		   </tr>
				   		   <?php 
				   		   		$sql = "select a.id,a.name,a.url,a.remark,a.counts,a.dates,b.name as type_name from en_download as a inner join en_download_type as b on a.type_=b.id  where a.flag =1";
				   		   		$result = mysql_query($sql);
				   		   		
				   		   		while($row = mysql_fetch_array($result))
				   		   		{
				   		   	?>
				   		   		<tr style='cursor:pointer;'  onmouseover='mouseoverTD(this)' onmouseout='mouseoutTD(this)'>
				   		   			<td class="context_td" style="width:100px; text-align:center;"><?php echo $row['name'];?></td>
				   		   			<td class="context_td" style="width:100px; text-align:center;"><?php echo $row['dates'];?></td>
				   		   			<td class="context_td" style="width:100px; text-align:center;"><?php echo $row['type_name'];?></td>
				   		   			<td class="context_td" style="width:100px; text-align:center;">
				   		   			<a style='text-decoration:underline;' href='javascript:return false;' onclick="del('<?php echo $row['id']?>',this)">删除</a>
				   		   			<a style='text-decoration:underline;' href='downloadAdd.php?flag=update&id=<?php echo $row['id']?>'>修改</a>
				   		   			</td>
				   		   		</tr>
				   		   	
				   		   	<?php
				   		   		}
				   		   ?>
				  </table> 		   
		       </div>
		  </div>
		 </div>
		 <div id="bottom"></div>
</div>		  